package com.haojiang.mh.remote.utils

import com.haojiang.mh.AppContext
import com.haojiang.mh.R
import com.haojiang.mh.remote.bean.AreaValue
import com.haojiang.mh.remote.bean.ControlLeftMenuBean
import com.haojiang.mh.remote.enums.EArea
import com.haojiang.mh.remote.enums.EMassage
import com.haojiang.mh.remote.enums.EMemory
import com.haojiang.mh.remote.enums.EMotor


object MenuUtil {


    val menuMap = hashMapOf<Int, ControlLeftMenuBean>(

        EArea.MOTOR.key to
                ControlLeftMenuBean(
                    EArea.MOTOR.key,
                    AppContext.instance().getString(R.string.f_surface_postion),
                    R.drawable.ic_motor_n,
                    R.drawable.ic_motor_p
                ),

        EArea.MASSAGE.key to
                ControlLeftMenuBean(
                    EArea.MASSAGE.key,
                    AppContext.instance().getString(R.string.f_surface_massage),
                    R.drawable.ic_massage_n,
                    R.drawable.ic_massage_p
                ),

        EArea.MEMORY.key to
                ControlLeftMenuBean(
                    EArea.MEMORY.key,
                    AppContext.instance().getString(R.string.f_surface_memory),
                    R.drawable.ic_memory_n,
                    R.drawable.ic_memory_p
                ),

        EArea.ALARM.key to
                ControlLeftMenuBean(
                    EArea.ALARM.key,
                    AppContext.instance().getString(R.string.f_surface_alarm),
                    R.drawable.ic_alarm_n,
                    R.drawable.ic_alarm_p
                ),

        EArea.LED.key to
                ControlLeftMenuBean(
                    EArea.LED.key,
                    AppContext.instance().getString(R.string.f_surface_led),
                    R.drawable.ic_led_n,
                    R.drawable.ic_led_p
                ),

        EArea.AROMA.key to
                ControlLeftMenuBean(
                    EArea.AROMA.key,
                    AppContext.instance().getString(R.string.f_surface_aroma),
                    R.drawable.ic_aroma_n,
                    R.drawable.ic_aroma_p
                ),

        EArea.SLEEP.key to
                ControlLeftMenuBean(
                    EArea.SLEEP.key,
                    AppContext.instance().getString(R.string.f_surface_sleep),
                    R.drawable.ic_sleep_n,
                    R.drawable.ic_sleep_p
                ),

//        EArea.NEW_MOTOR.key to
//                ControlLeftMenuBean(
//                    EArea.NEW_MOTOR.key,
//                    "马达新",
//                    R.drawable.ic_motor_norm,
//                    R.drawable.ic_motor_press
//                ),
//        EArea.NEW_MEMORY.key to
//                ControlLeftMenuBean(
//                    EArea.NEW_MEMORY.key,
//                    "记忆位置新",
//                    R.drawable.ic_memory_norm,
//                    R.drawable.ic_memory_press
//                ),
//        EArea.NEW_MASSAGE.key to
//                ControlLeftMenuBean(
//                    EArea.NEW_MASSAGE.key,
//                    "按摩器新",
//                    R.drawable.ic_massage_norm,
//                    R.drawable.ic_massage_press
//                ),
//        EArea.NEW_ALARM.key to
//                ControlLeftMenuBean(
//                    EArea.NEW_ALARM.key,
//                    "闹钟新",
//                    R.drawable.ic_alarm_norm,
//                    R.drawable.ic_alarm_press
//                )
    )

    val motorMap: MutableMap<Int, MutableList<AreaValue>> = mutableMapOf()
    val memoryMap: MutableMap<Int, MutableList<AreaValue>> = mutableMapOf()
    val massageMap: MutableMap<Int, MutableList<AreaValue>> = mutableMapOf()
//    val alarmList = ArrayList<String>()


    fun setFunctionList(list: List<String?>) {
        list.let {
            motorMap.clear()
            memoryMap.clear()
            massageMap.clear()
//            alarmList.clear()
            if (list.size > 0) {
                for (key in list) {
                    val areaValue = CmdUtil.viewMap.get(key)
                    areaValue?.let {
                        when (it.erea) {
                            EArea.MOTOR.key -> {
                                when (it.code) {
                                    //头部上升和下降
                                    CmdKey.HEAD_UP,
                                    CmdKey.HEAD_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "头部上升和下降")
                                        var cmdList = motorMap.get(EMotor.HEAD.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.HEAD.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //脚部上升和下降
                                    CmdKey.FOOT_UP,
                                    CmdKey.FOOT_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = motorMap.get(EMotor.FOOT.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.FOOT.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //枕部上升和下降
                                    CmdKey.PILLOW_UP,
                                    CmdKey.PILLOW_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "枕部上升和下降")
                                        var cmdList = motorMap.get(EMotor.PILLOW.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.PILLOW.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //腰部上升和下降
                                    CmdKey.LUMBAR_UP,
                                    CmdKey.LUMBAR_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "腰部上升和下降")
                                        var cmdList = motorMap.get(EMotor.LUMBAR.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.LUMBAR.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //腰部上升和下降
                                    CmdKey.MOTOR5_UP,
                                    CmdKey.MOTOR5_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "腰部上升和下降")
                                        var cmdList = motorMap.get(EMotor.MOTOR5.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.MOTOR5.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //腰部上升和下降
                                    CmdKey.MOTOR6_UP,
                                    CmdKey.MOTOR6_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "腰部上升和下降")
                                        var cmdList = motorMap.get(EMotor.MOTOR6.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.MOTOR6.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //长按 头部和脚部同升同降
                                    CmdKey.HEAD_FOOT_BOTH_UP,
                                    CmdKey.HEAD_FOOT_BOTH_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "头部和脚部同升同降")
                                        var cmdList = motorMap.get(EMotor.HEAD_FOOT_BOTH.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.HEAD_FOOT_BOTH.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //长按 枕部和腰部同升同降
                                    CmdKey.PILLOW_LUMBAR_BOTH_UP,
                                    CmdKey.PILLOW_LUMBAR_BOTH_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "枕部和腰部同升同降")
                                        var cmdList = motorMap.get(EMotor.PILLOW_LUMBAR_BOTH.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.PILLOW_LUMBAR_BOTH.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //长按 枕部倾斜和腰部倾斜同升同降
                                    CmdKey.PILLOW_LUMBAR_BOTH_TILT_UP,
                                    CmdKey.PILLOW_LUMBAR_BOTH_TILT_DOWN -> {
                                        //                                    LogUtil.e(it.toString() + "枕部和腰部同升同降")
                                        var cmdList = motorMap.get(EMotor.PILLOW_LUMBAR_BOTH_TILT.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.PILLOW_LUMBAR_BOTH_TILT.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }



                                    //床底灯关
                                    CmdKey.UBL_OFF -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = motorMap.get(EMotor.UBL_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.UBL_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }


                                    CmdKey.FLAT -> {
                                        var cmdList = motorMap.get(EMotor.FLAT.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.FLAT.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //床底灯开关
                                    CmdKey.UBL_ON_OFF -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = motorMap.get(EMotor.UBL_ON_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            motorMap.put(EMotor.UBL_ON_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    else -> {
                                    }
                                }
                            }

                            EArea.MEMORY.key -> {
                                when (it.code) {
                                    //tv
                                    CmdKey.TV_SET_POS,
                                    CmdKey.TV_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "头部上升和下降")
                                        var cmdList = memoryMap.get(EMemory.TV.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.TV.key, cmdList)
                                        }
                                        //添加tv闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.TV_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //zg
                                    CmdKey.ZG_SET_POS,
                                    CmdKey.ZG_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = memoryMap.get(EMemory.ZG.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.ZG.key, cmdList)
                                        }
                                        //添加zg闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.ZG_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //zg2
                                    CmdKey.ZG2_SET_POS,
                                    CmdKey.ZG2_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = memoryMap.get(EMemory.ZG2.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.ZG2.key, cmdList)
                                        }
                                        //添加zg闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.ZG2_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //Snore
                                    CmdKey.SNORE_SET_POS,
                                    CmdKey.SNORE_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "枕部上升和下降")
                                        var cmdList = memoryMap.get(EMemory.SNORE.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.SNORE.key, cmdList)
                                        }
                                        //添加zg闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.SNORE_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //LOUNGE
                                    CmdKey.LOUNGE_SET_POS,
                                    CmdKey.LOUNGE_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "腰部上升和下降")
                                        var cmdList = memoryMap.get(EMemory.LOUNGE.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.LOUNGE.key, cmdList)
                                        }
                                        //添加lounge闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.LOUNGE_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //M1
                                    CmdKey.M1_SET_POS,
                                    CmdKey.M1_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "头部和脚部同升同降")
                                        var cmdList = memoryMap.get(EMemory.M1.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.M1.key, cmdList)
                                        }
                                        //添加m1闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.M1_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }

                                    //M2
                                    CmdKey.M2_SET_POS,
                                    CmdKey.M2_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "枕部和腰部同升同降")
                                        var cmdList = memoryMap.get(EMemory.M2.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.M2.key, cmdList)
                                        }
                                        //添加m1闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.M2_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //M3
                                    CmdKey.M3_SET_POS,
                                    CmdKey.M3_BACK_POS -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = memoryMap.get(EMemory.M3.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.M3.key, cmdList)
                                        }
                                        //添加m1闹钟功能代码到闹钟集合中
//                                        if (it.code == CmdKey.M3_BACK_POS && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }


                                    //腰托记忆
                                    CmdKey.LUMBAR_BACK_POS,
                                    CmdKey.LUMBAR_SET_POS -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = memoryMap.get(EMemory.LUMBAR.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.LUMBAR.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }
                                    //                                    CmdKey.FLAT -> {
                                    ////                                    LogUtil.e(it.toString() + "床底灯")
                                    //                                        var cmdList = memoryMap.get(Constant.ITEM_FLAT)
                                    //                                        if (cmdList == null) {
                                    //                                            cmdList = mutableListOf()
                                    //                                            memoryMap.put(Constant.ITEM_FLAT, cmdList)
                                    //                                        }
                                    //                                        cmdList.add(it)
                                    //                                    }

                                    CmdKey.FLAT2 -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = memoryMap.get(EMemory.FLAT2.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.FLAT2.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    CmdKey.FACTORY_RESET -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = memoryMap.get(EMemory.FACTORY_RESET.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.FACTORY_RESET.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    CmdKey.RELAX -> {
                                        //                                    LogUtil.e(it.toString() + "床底灯")
                                        var cmdList = memoryMap.get(EMemory.RELAX.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.RELAX.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //（单次）一键同步上升  一键同升(头部+腿部)
                                    CmdKey.HEAD_UP_FOOT_UP -> {
                                        var cmdList = memoryMap.get(EMemory.HEAD_UP_FOOT_UP.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.HEAD_UP_FOOT_UP.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //（单次）头部上升脚部下降
                                    CmdKey.HEAD_UP_FOOT_DOWN -> {
                                        var cmdList = memoryMap.get(EMemory.HEAD_UP_FOOT_DOWN.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.HEAD_UP_FOOT_DOWN.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //（单次）头部下降脚部上升
                                    CmdKey.HEAD_DOWN_FOOT_UP -> {
                                        var cmdList = memoryMap.get(EMemory.HEAD_DOWN_FOOT_UP.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.HEAD_DOWN_FOOT_UP.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //（单次）一键头部上升
                                    CmdKey.HEAD_UP_ONLY -> {
                                        var cmdList = memoryMap.get(EMemory.HEAD_UP_ONLY.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.HEAD_UP_ONLY.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //（单次）一键脚部上升
                                    CmdKey.FOOT_UP_ONLY -> {
                                        var cmdList = memoryMap.get(EMemory.FOOT_UP_ONLY.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            memoryMap.put(EMemory.FOOT_UP_ONLY.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    else -> {
                                    }
                                }
                            }

                            EArea.MASSAGE.key -> {
                                when (it.code) {
                                    //按摩器头部增强和脚部按摩器增强
                                    CmdKey.MSG_HEAD_INTENSITY_INC,
                                    CmdKey.MSG_FOOT_INTENSITY_INC -> {
                                        //                                    LogUtil.e(it.toString() + "头部上升和下降")
                                        var cmdList = massageMap.get(EMassage.HEAD_INTENSITY_INC.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_INTENSITY_INC.key, cmdList)
                                        }
                                        //添加头部按摩器功能代码到闹钟集合中
//                                        if (it.code == CmdKey.MSG_HEAD_INTENSITY_INC && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        //添加脚部按摩器功能代码到闹钟集合中
//                                        if (it.code == CmdKey.MSG_FOOT_INTENSITY_INC && !alarmList.contains(it.code)) {
//                                            alarmList.add(it.code)
//                                        }
                                        cmdList.add(it)
                                    }
                                    //按摩器头部按摩器减弱脚部按摩器减弱
                                    CmdKey.MSG_HEAD_INTENSITY_DEC,
                                    CmdKey.MSG_FOOT_INTENSITY_DEC -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.FOOT_INTENSITY_INC.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.FOOT_INTENSITY_INC.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器头部脚步强度同增强同减弱
                                    CmdKey.MSG_HEAD_FOOT_INTENSITY_INC,
                                    CmdKey.MSG_HEAD_FOOT_INTENSITY_DEC -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.HEAD_FOOT_BOTH_INTENSITY.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_FOOT_BOTH_INTENSITY.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器头部脚步速度同增强同减弱
                                    CmdKey.MSG_HEAD_FOOT_SPEED_INC,
                                    CmdKey.MSG_HEAD_FOOT_SPEED_DEC -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.HEAD_FOOT_BOTH_SPEED.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_FOOT_BOTH_SPEED.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //模式样式 mode
                                    CmdKey.MSG_MODE -> {
                                        var cmdList = massageMap.get(EMassage.MODE.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.MODE.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }


                                    //模式样式 constant-pulse-wave
                                    CmdKey.MSG_CONSTANT,
                                    CmdKey.MSG_PULSE,
                                    CmdKey.MSG_WAVE, -> {
                                        var cmdList = massageMap.get(EMassage.MODE2.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.MODE2.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //模式wave1--wave2--wave3
                                    CmdKey.MSG_WAVE1,
                                    CmdKey.MSG_WAVE2,
                                    CmdKey.MSG_WAVE3 -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.WAVE.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.WAVE.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //                                    //床底灯开关
                                    //                                    CmdKey.UBL_ON_OFF -> {
                                    ////                                    LogUtil.e(it.toString() + "床底灯")
                                    //                                        var cmdList = massageMap.get(Constant.ITEM_UBL_ON_OFF)
                                    //                                        if (cmdList == null) {
                                    //                                            cmdList = mutableListOf()
                                    //                                            massageMap.put(Constant.ITEM_UBL_ON_OFF, cmdList)
                                    //                                        }
                                    //                                        cmdList.add(it)
                                    //                                    }
                                    //
                                    //                                    //床底灯关
                                    //                                    CmdKey.UBL_OFF -> {
                                    ////                                    LogUtil.e(it.toString() + "床底灯")
                                    //                                        var cmdList = massageMap.get(Constant.ITEM_UBL_OFF)
                                    //                                        if (cmdList == null) {
                                    //                                            cmdList = mutableListOf()
                                    //                                            massageMap.put(Constant.ITEM_UBL_OFF, cmdList)
                                    //                                        }
                                    //                                        cmdList.add(it)
                                    //                                    }

                                    //香薰-开关
                                    CmdKey.MSG_AROMA_ON_OFF -> {
                                        var cmdList = massageMap.get(EMassage.AROMA_ON_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.AROMA_ON_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器头部开关脚部开关
                                    CmdKey.MSG_HEAD_ON_OFF,
                                    CmdKey.MSG_FOOT_ON_OFF -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.HEAD_FOOT_ON_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_FOOT_ON_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    CmdKey.MSG_HEAD_FOOT_BOTH_ON -> {
                                        //                                    LogUtil.e(it.toString() + "脚部上升和下降")
                                        var cmdList = massageMap.get(EMassage.HEAD_FOOT_BOTH_ON.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_FOOT_BOTH_ON.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }





                                    //按摩器-时间
                                    CmdKey.MSG_10MIN,
                                    CmdKey.MSG_20MIN,
                                    CmdKey.MSG_30MIN -> {
                                        var cmdList = massageMap.get(EMassage.MIN.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.MIN.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器-强度
                                    CmdKey.MSG_INTENSITY1,
                                    CmdKey.MSG_INTENSITY2,
                                    CmdKey.MSG_INTENSITY3-> {
                                        var cmdList = massageMap.get(EMassage.INTENSITY.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.INTENSITY.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //头部脚部按摩器强度增强-兼容用
                                    CmdKey.MSG_HEAD_INTENSITY_INC2,
                                    CmdKey.MSG_FOOT_INTENSITY_INC2-> {
                                        var cmdList = massageMap.get(EMassage.HEAD_INTENSITY_INC2.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_INTENSITY_INC2.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器关闭
                                    CmdKey.MSG_OFF -> {
                                        var cmdList = massageMap.get(EMassage.MSG_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.MSG_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    //按摩器-关闭
                                    CmdKey.MSG_HEAD_FOOT_BOTH_OFF -> {
                                        var cmdList = massageMap.get(EMassage.HEAD_FOOT_BOTH_OFF.key)
                                        if (cmdList == null) {
                                            cmdList = mutableListOf()
                                            massageMap.put(EMassage.HEAD_FOOT_BOTH_OFF.key, cmdList)
                                        }
                                        cmdList.add(it)
                                    }

                                    else -> {
                                    }
                                }
                            }

                            else -> {
                            }
                        }
                    }
                }

            }
        }
    }

}